meson.build: Improve F16C detection on Visual Studio
authorChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 12 Apr 2021 08:24:37 +0000 (16:24 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 12 Apr 2021 10:13:42 +0000 (18:13 +0800)
The __builtin_cpu...() intrisics are strictly for GCC/CLang-based compilers, so
don't use them in the checking code on Visual Studio.  The test code will still
compile without this change, but will certainly fail if we want it to link.

meson.build

index 641208158caee495510e079101cfe054b648f7b0..902bd72031f026bb85ed39a951f106e9c8df2758 100644 (file)
@@ -707,8 +707,10 @@ int main () {
   __m128i i = _mm_cvtps_ph (s, 0);
   _mm_storel_epi64 ((__m128i*)h, i);
 
+#if defined (__GNUC__) || defined (__clang__)
   __builtin_cpu_init ();
   __builtin_cpu_supports ("f16c");
+#endif
 
     return 0;
 }'''